<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业物联网转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
namespace app\controller\api\items\common;

use think\App;
use app\controller\api\Base;
use app\common\services\CacheService;
use app\common\repositories\housing\HousingLabelRepository;

class HousingCommon extends Base
{

    public function __construct(App $app)
    {
        parent::__construct($app);

    }

    /**
     * 获取房源标签
     * @return mixed
     *
     * @author Amos
     * 2024-06-12 10:02
     */
    public function labelList(HousingLabelRepository $labelRepository)
    {
        $where = $this->request->param([
            'keywords' => ''
        ]);
        $where['is_show'] = 1;
        $res = CacheService::create($this->request->propertyId)
            ->remember('housing_label_' . $this->request->propertyId, function () use ($where, $labelRepository) {
                return $labelRepository->getApiAllList($where, $this->request->propertyId);
            }, 86400);
        return app('api_return')->success($res);
    }


}